	<div id="main">
		<ol class="breadcrumb">
		  <li><a href="{:U('Index/main')}"><span class="glyphicon glyphicon-home"></span></a></li>{$breadcrumb}
		</ol>
		
		<div class="row">
            <div class="col-md-12">
                <!-- Advanced Tables -->
                <div class="panel panel-default">
                    <div class="panel-heading">
                         {$other_action}
                    </div>
                    <div class="panel-body">
                    	<form class="form-horizontal">
						  <div class="form-group">
						    <label class="col-sm-2 control-label">
						    	管理组名(必填)
						    </label>
						    <div class="col-sm-10">
						      <input type="title" name="title" datatype="*1-50" value="{$data.title}" nullmsg="请填写管理组名" errormsg="字数不能超过50个字" class="form-control" placeholder="">
						    </div>
						  </div>
						  <div class="form-group">
						    <label class="col-sm-2 control-label">
						    	简介
						    </label>
						    <div class="col-sm-10">
						      <textarea name="description" class="form-control">{$data.description}</textarea>
						    </div>
						  </div>
						  
						  <div class="form-group">
						    <label class="col-sm-2 control-label">
						    	是否禁用
						    </label>
						    <div class="col-sm-10">
								<label class="radio-inline">
								  <input type="radio" name="status" value="0" {$data['status'] == 0 ? 'checked' : ''}> 是
								</label>
								<label class="radio-inline">
								  <input type="radio" name="status" value="1" {$data['status'] == 1 ? 'checked' : ''}> 否
								</label>
						    </div>
						  </div>
						  <div class="form-group">
						    <label class="col-sm-2 control-label">
						    	<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="bottom" data-original-title="请选择该用户组所拥有的操作权限"></span>
						    	拥有权限
						    </label>
						    <div class="col-sm-10">
								<div class="table-responsive">
		                            <table class="table table-striped table-bordered table-hover" style="max-width: 750px;">
		                                <tbody>
		                                	{$rule_html}
		                                </tbody>
		                            </table>
		                        </div>
						    </div>
						  </div>
						  <div class="form-group">
						    <div class="col-sm-offset-2 col-sm-10">
						      <button type="submit" class="btn btn-primary ajax-post is-validform" data-url="__SELF__" data-location="{:U('group')}" data-location-title="返回管理组列表">保存</button>
						    </div>
						  </div>
						</form>
                    </div>
                 </div>
              </div>
         </div>
	</div>
	<script>
	$(function(){
		function select_other_childs (input_obj){
			var input_id = input_obj.val();
			if ($('input.rules[data-pid='+input_id+']').length){
				if (input_obj.is(':checked')){
					$('input.rules[data-pid='+input_id+']').prop('checked', true);
				} else {
					$('input.rules[data-pid='+input_id+']').prop('checked', false);
				}
				$('input.rules[data-pid='+input_id+']').each(function(i,v){
					select_other_childs($(v));
				})
			}
		}
		function select_other_parents (input_obj){
			var pid = input_obj.attr('data-pid');
			if ($('input.rules[data-id='+pid+']').length){
				if (input_obj.is(':checked')){
					$('input.rules[data-id='+pid+']').prop('checked', true);
				}
				$('input.rules[data-id='+pid+']').each(function(i,v){
					select_other_parents($(v));
				})
			}
		}
		$('.rules').change(function(){
			select_other_childs($(this));
			select_other_parents($(this));
		})
	})
	</script>